/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alberto
 */
@Entity
@Table(name = "recetas")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Recetas.findAll", query = "SELECT r FROM Recetas r"),
    @NamedQuery(name = "Recetas.findByIdreceta", query = "SELECT r FROM Recetas r WHERE r.idreceta = :idreceta")})
public class Recetas implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDRECETA")
    private Integer idreceta;
    @Lob
    @Size(max = 65535)
    @Column(name = "MODO_PREPARACION")
    private String modoPreparacion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "recetas")
    private Collection<Recetasinsumos> recetasinsumosCollection;

    public Recetas() {
    }

    public Recetas(Integer idreceta) {
        this.idreceta = idreceta;
    }

    public Integer getIdreceta() {
        return idreceta;
    }

    public void setIdreceta(Integer idreceta) {
        this.idreceta = idreceta;
    }

    public String getModoPreparacion() {
        return modoPreparacion;
    }

    public void setModoPreparacion(String modoPreparacion) {
        this.modoPreparacion = modoPreparacion;
    }

    @XmlTransient
    public Collection<Recetasinsumos> getRecetasinsumosCollection() {
        return recetasinsumosCollection;
    }

    public void setRecetasinsumosCollection(Collection<Recetasinsumos> recetasinsumosCollection) {
        this.recetasinsumosCollection = recetasinsumosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idreceta != null ? idreceta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Recetas)) {
            return false;
        }
        Recetas other = (Recetas) object;
        if ((this.idreceta == null && other.idreceta != null) || (this.idreceta != null && !this.idreceta.equals(other.idreceta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Recetas[ idreceta=" + idreceta + " ]";
    }
    
}
